
# Units and factors used for conversions
UNITS = {'d': 1.0, 'h': 1/24.0, 's': 1/86400.0, 'ls': 1/86.4}

def conv(value, to_unit, from_unit):
    """
    Returns the value given in from_units converted to to_units.
    
    Parameters
    ----------
    
    value : float
        value to convert
    to_unit : string
        unit to convert
    from_unit : string
        the given unit of the value
    """
    return value * UNITS[from_unit] / UNITS[to_unit]
